<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/c" prefix="c" %>
<%@taglib prefix="display" uri="http://displaytag.sf.net/el"%>
<%@ page import="java.text.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="com.solution.webconstant.PermissionConstants" %>

<%
	HashMap permissionMap = ((HashMap)(session.getAttribute("userPermissionsInfo")));
%>
<script language="JavaScript">
function fnSearch()
{
	document.examForm.action='/searchExam.do?';
	document.examForm.submit();
}
function fnEditViewExamDetails(exam_id_value, screen_type_value){
	document.examForm.screen_type.value=screen_type_value;
	document.examForm.exam_id.value=exam_id_value;
	document.examForm.action='/editViewExam.do?';
	document.examForm.submit();
}
function clearForm(formObj){
	var elements = formObj.elements;
	for(i=0; i<elements.length; i++){
		if(elements[i].type == "text")
			elements[i].value = "";
		if(elements[i].type == "select-one" || elements[i].type == "select-multiple")
			elements[i].selectedIndex = 0;
	}
}
</script>
<script language="JavaScript" src="js/Calendar.js" type="text/JavaScript"></script>
<html:form action="/searchExam">
	<html:hidden property="show_list" />
	<html:hidden property="screen_type" />
	<html:hidden property="exam_id" />
	<%String linktab = (String)request.getAttribute("selectedTab"); %>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
	    <td>
	    	<table width="700px" border="0" cellspacing="0" cellpadding="0">
	  			<tr>
					<%if("CREATE".equalsIgnoreCase(linktab)) {%>
				    <td class="activeTabc1"></td>
				    <td class="activeTabbg"><div align="center" class="style10"><a href="<%=request.getAttribute("createLink")%>">Create</a></div></td>
				    <td class="activeTabc2"></td>
					<%} else {%>
					<td class="inactiveTabc1"></td>
				    <td class="inactiveTabbg"><div align="center" class="style11"><a href="<%=request.getAttribute("createLink")%>">Create</a></div></td>
				    <td class="inactiveTabc2"></td>
					<%}%>
				    <td class="spacer"></td>
					<%if("EDIT".equalsIgnoreCase(linktab)) {%>
					<td class="activeTabc1"></td>
				    <td class="activeTabbg"><div align="center" class="style10"><a href="<%=request.getAttribute("editLink")%>">Edit</a></div></td>
				    <td class="activeTabc2"></td>
					<%} else{%>
				    <td class="inactiveTabc1"></td>
				    <td class="inactiveTabbg"><div align="center" class="style11"><a href="<%=request.getAttribute("editLink")%>">Edit</a></div></td>
				    <td class="inactiveTabc2"></td>
					<%}%>
				    <td class="spacer"></td>
					<%if("VIEW".equalsIgnoreCase(linktab)) {%>
					<td class="activeTabc1"></td>
				    <td class="activeTabbg"><div align="center" class="style10"><a href="<%=request.getAttribute("viewLink")%>">View</a></div></td>
				    <td class="activeTabc2"></td>
					<%} else{%>
				    <td class="inactiveTabc1"></td>
				    <td class="inactiveTabbg"><div align="center" class="style11"><a href="<%=request.getAttribute("viewLink")%>">View</a></div></td>
				    <td class="inactiveTabc2"></td> 
					<%}%>
	  			</tr>
			</table>
		</td>
  	</tr>
  	<tr>
    	<td class="formbg" valign="top">
    		<table width="100%" border="0" cellspacing="0" cellpadding="0">
  				<tr>
    				<td>
    					<table width="100%" border="0" cellspacing="4" cellpadding="0">
							<tr>
								<td>&nbsp;</td>	
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td colspan="6"><jsp:include page="showErrorMessage.jsp"/></td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td class="formText">Name</td>
								<td><input type="text" name="exam_name" id="exam_name" maxlength="30" class="form1" 
								value='<bean:write name="examForm" property="exam_name"/>'/></td>
								<td class="formText">Duration(Hr:Min)</td>
		    					<td><span class="form4"><html:select styleId="exam_time_hr" property="exam_time_hr" >
		    							<html:option value="">--</html:option>
										<html:option value="0">00</html:option>
										<html:option value="1">01</html:option>
										<html:option value="2">02</html:option>
										<html:option value="3">03</html:option>
										<html:option value="4">04</html:option>
										<html:option value="5">05</html:option>
										<html:option value="6">06</html:option>
									</html:select>
									<html:select  styleId="exam_time_min" property="exam_time_min" >
										<html:option value="">--</html:option>
										<html:option value="0">00</html:option>
										<html:option value="5">05</html:option>
										<html:option value="10">10</html:option>
										<html:option value="15">15</html:option>
										<html:option value="20">20</html:option>
										<html:option value="25">25</html:option>
										<html:option value="30">30</html:option>
										<html:option value="35">35</html:option>
										<html:option value="40">40</html:option>
										<html:option value="45">45</html:option>
										<html:option value="50">50</html:option>
										<html:option value="55">55</html:option>
									</html:select></span></td>
								<td>&nbsp;</td>
							</tr>
							<tr>	
								<td>&nbsp;</td>
								<td class="formText">Status</td>
								<td>
									<html:select styleClass="form2" property="status" styleId="status">
										<html:option value="">--Please Select--</html:option>
										<html:option value="2">Active</html:option>
										<html:option value="3">InActive</html:option>
									</html:select>
								</td>
								<td class="formText">Negative Marking</td>
		    					<td><html:select styleClass="form2" property="negative_enable" styleId="negative_enable">
									<html:option value="0">Disable</html:option>
									<html:option value="1">Enable</html:option>
									</html:select></td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td class="formText">Multiple Choice</td>
		    					<td><html:select styleClass="form2" property="multiple_choice_enable" styleId="multiple_choice_enable">
									<html:option value="0">Disable</html:option>
									<html:option value="1">Enable</html:option>
									</html:select></td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td class="formText">Exam Created Between</td>
								<td>
									<html:text property="exam_create_from" styleId="exam_create_from" 
									styleClass="form1" readonly="true"/><a href="Javascript:ShowCalendar(document.getElementById('exam_create_from'),2010,2050,'mm/dd/yyyy')" border="0" >
									<img src="images/icon_calendar.gif" width="16" height="15" border="0" hspace="5"></a>					
									<html:text property="exam_create_to" styleId="exam_create_to" 
									styleClass="form1" readonly="true"/><a href="Javascript:ShowCalendar(document.getElementById('exam_create_to'),2010,2050,'mm/dd/yyyy')" border="0" >
									<img src="images/icon_calendar.gif" width="16" height="15" border="0" hspace="5"></a>
								</td>
							</tr>
							<tr>
								<td height="25" colspan="4" align="center" valign="top" >&nbsp;</td>
							</tr>
							<tr>
		       	 				<td height="25" colspan="4" align="center" valign="top">
		       	 					<input type="button" class="imageButton" value="Search" onClick="JavaScript:fnSearch()">
		       	 					<input type="button" class="imageButton" value="Reset" onClick="JavaScript:clearForm(this.form)">
		       	 				</td>
		      				</tr>
		      				<tr>
								<td height="25" colspan="4" align="center" valign="top" >&nbsp;</td>
							</tr>
							<tr>
								<td colspan="5">
									<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
										<logic:equal name="examForm" property="show_list" value="Y">
										<tr>
											<td>
												<display:table name="examForm.exam_list" decorator="com.solution.decorator.ExamDecorator"
													export="false"	requestURI="/searchExam.do" cellspacing="0" cellpadding="0"
													pagesize="10" class="results" id="exam">
													<display:column property="id" title="ID" />
													<display:column property="name" title="Name" />
													<display:column property="description" title="Description" />
													<display:column property="time" title="Duration(Sec)" />
													<logic:present property="status" name="exam">
													<bean:define id="displayStatus" property="status" name="exam"/>
													<display:column title="Status"><bean:message key="<%="Status."+displayStatus%>"/></display:column>
													</logic:present>
													<logic:equal name="examForm" property="screen_type" value="Edit">
														<display:column property="actionEdit" title="Action" />
													</logic:equal>
													<logic:equal name="examForm" property="screen_type" value="View">
														<display:column property="actionView" title="Action" />
													</logic:equal>
													<display:setProperty name="basic.msg.empty_list">&nbsp;</display:setProperty> 
												</display:table>
											</td>
					            		</tr>
					            		</logic:equal>
					          		</table>
					          	</td>
							</tr>
      					</table>
	  				</td>
				</tr>
  			</table>
</html:form>